package ru.ifmo.itmokis.domain;

import java.io.Serializable;
import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author Ivan Stepuk
 */
@Entity
@Table(name = "Supplies")
public class Supply implements Serializable {

    private int id;
    private Time orderTime;
    private Time deliveryTime;
    private Material material;
    private int qty;

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Embedded
    @AttributeOverride(name = "value", column =
    @Column(name = "orderTime"))
    public Time getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Time orderTime) {
        this.orderTime = orderTime;
    }

    @Embedded
    @AttributeOverride(name = "value", column =
    @Column(name = "deliveryTime"))
    public Time getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(Time deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    @ManyToOne
    @JoinColumn(name = "material", referencedColumnName = "id")
    public Material getMaterial() {
        return material;
    }

    public void setMaterial(Material material) {
        this.material = material;
    }

    public int getQty() {
        return qty;
    }

    public void setQty(int qty) {
        this.qty = qty;
    }
}
